package de.unikoblenz.west.csxpoi.server.connector;

import de.unikoblenz.west.csxpoi.server.connector.*;

/**
 * The factory class that returns a specific connector to a datastore
 * 
 * @author Yassin Nachite
 *
 */
public class ConnectorFactory {

	/**
	 * the constant representing the connection type http
	 */
	public static final int HTTP = 1;
	
	/**
	 * the constant representing the connection type sesame
	 */
	public static final int SESAME = 2;
	
	/**
	 * the constant representing the query type RDF (Sparql)
	 */
	public static final int RDF = 1;
	
	/**
	 * the constant representing a Restful query type 
	 */
	public static final int REST = 2;

	/**
	 * Gets a connector to a datastore
	 * 
	 * @param type		connection type of the datastore
	 * @param protocol 	query type of the datastore
	 * @param url		address of the datastore
	 * @param repositoryID	ID of the datastore
	 * @return the connector
	 */
	public static SourceConnector getConnection(int type, int protocol,
			String url, String repositoryID) {

		

		if(type == HTTP) {
//TODO: create HTTP source connectors to other data sources
			switch (protocol) {
			case RDF:
				return null;

			case REST:
				return nill;

			}
		}
		else if(type == SESAME){
			
			switch (protocol) {
			case RDF:
				return new StevieRDFConnector(url, repositoryID);

			case REST:{
				return new StevieRESTConnector(url, repositoryID);
			}
			default:
				return null;
			}
		}

			return null;
		

	}

}
